<?php if (!defined('THINK_PATH')) exit(); /*a:1:{s:68:"D:\laragon\www\zgh\public/../application/admin\view\login\index.html";i:1531298328;}*/ ?>
﻿<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>知果汇</title>
    <link rel="stylesheet" type="text/css" href="_CSS_/style.css">
    <link href="_CSS_/simple-line-icons.css" rel="stylesheet">
    <style type="text/css">
        html, body {
            margin: 0px;
            width: 100%;
            height: 100%;
        }

        body {
            background-color: #323e58;
            min-width: 356px;
            overflow: auto;
            color: #ffffff;
        }

        .main-body {
            width: 892px;
            height: 356px;
            margin: 0 auto;
            padding-top: 200px;
        }

        .main-left {
            width: 435px;
            height: 100%;
            border-right: 1px solid #aaaaaa;
            text-align: center;
            padding-top: 80px;
        }

        .main-left p {
            margin: 0 0 10px;
        }

        .main-left img {
            margin-bottom: 30px;
        }

        .main-right {
            width: 375px;
            height: 100%;
            padding-right: 35px;
        }

        input {
            border: 1px solid #ffffff;
        }

        .main-right p {
            -webkit-margin-before: 0em;
            -webkit-margin-after: 0em;
            margin-top: 5px;
        }

        .login-box label {
            display: block;
            float: left;
            width: 364px;
            margin-top: 36px;
            font-size: 18px;
            font-weight: normal;
            line-height: 46px;
        }

        .login-box label span {
            margin-right: 5px;
        }

        .login-box input[type="text"], .login-box input[type="password"] {
            width: 265px;
            height: 40px;
            padding: 2px 3px;
            float: right;
            background-color: #323e58;
            color: #ffffff;
            font-size: 18px;
        }

        .login-box label button {
            width: 364px;
            height: 46px;
            line-height: 46px;
            color: #ffffff;
            background-color: #3d88d7;
            border: none;
            border-radius: 5px;
            font-size: 20px;
        }

        footer {
            position: absolute;
            bottom: 0;
            width: 100%;
        }

        footer p {
            text-align: center;
            font-size: 14px;
        }
    </style>
</head>
<body>
<div class="main-body">
    <div class="main-left fl">
        <img src="_IMG_/logo.png">
        <p style="font-size: 36px;">知果汇后台管理系统</p>
        <p style="font-size: 20px;">Background management system</p>
    </div>
    <div class="main-right fr">
        <p>登录/Login</p>
        <div class="login-box fl">
            <label><span class="icon-user"></span>帐号：<input id="username" type="text" name="" placeholder="用户名/手机号/邮箱"></label>
            <label><span class="icon-lock"></span>密码：<input id="password" type="password" name=""></label>
            <label>
                <button onclick="Login_btn()" id="Login">登陆</button>
            </label>
            <label style="margin-top: 5px;font-size: 16px;position: relative;"><input id="remember" type="checkbox"
                                                                                      name=""
                                                                                      style="position: absolute;top: 13.5px;"><span
                    style="margin-left: 20px;">记住我</span></label>
        </div>
    </div>

</div>
<footer>
    <p>Copyright©知果汇 版权所有</p>
</footer>
</body>
<script src="_JS_/jquery.min.js"></script>
<script src="_JS_/jquery.base64.js"></script>
<script src="_JS_/jquery.cookie.js"></script>
<script>
    var username = '';
    password = '';
    check_num = '';
    $("#password").keydown(function (event) {
        if (event.keyCode == 13) {
            Login_btn();
        }
    })

    function Login_btn() {
        var username = $("#username").val();
        var password = $("#password").val();
        if ($('#remember').is(':checked')) {
            var check_num = 1;
        } else {
            var check_num = 0;
        }
        if (username == "" || password == "") {
            alert("用户名或密码不能为空！");
        }
        else {
            $.ajax({
                type: "POST",
                url: "<?php echo url('api/Login/login'); ?>",
                dataType: 'json',
                data: {
                    "username": username,
                    "password": password
                },
                beforeSend: function () {
                },
                success: function (msg) {
                    if (msg.code == 200) {
                        var u_id = msg.data.uid;
                        user_info = [username, u_id, check_num];
                        userinfo = user_info.join(",")
                        $.cookie('username', $.base64.encode(userinfo), {expires: 7, path: '/'});
                        window.location.href = "<?php echo url('admin/person/index'); ?>";
                    }
                    if (msg.code == 1000) {
                        alert("帐号或密码错误");
                    }
                },
                complete: function (data) {
                    $("#loading").css("display", "none"); //点击登录后显示loading，隐藏输入框 
                    $("#login").css("display", "block");
                },
                error: function (XMLHttpRequest, textStatus, thrownError) {
                }
            });
        }
    };

    $(function () {
        var userinfo = $.cookie('username');
        if (userinfo != null) {
            var user_login = $.base64.decode(userinfo).split(",");
            if (user_login[2] == 1) {
                $('#remember').attr("checked", true);
                $("#username").val(user_login[0]);
            }
        }
    })
</script>
</html>